package cn.tuling.standard;

/**
 * 常规实现
 */
public class TemplateMethodTest {

    public static void main(String[] args) {
        Template template = new ConcreteClass();
        template.templateMethod();
    }
}

abstract class Template {
    public void specificMethod() {
        System.out.println("执行具体方法");
    }

    public abstract void absMethod1();

    public abstract void absMethod2();

    public void templateMethod() {
        specificMethod();
        absMethod1();
        absMethod2();
    }
}

class ConcreteClass extends Template {

    @Override
    public void absMethod1() {
        System.out.println("执行抽象方法1");
    }

    @Override
    public void absMethod2() {
        System.out.println("执行抽象方法2");
    }
}